/*
 * demo1.cpp
 *
 *  Created on: 2012-8-20
 *      Author: huangyansheng
 */

#include <gtest/gtest.h>

class Shop{
public:
int total_5(int price,int number);
};
//计算商品总价
int Shop::total_5(int price,int number)
{
	if(price<0)
		return -1;
	else if(number<0)
		return -1;
	else
		return price*number;
}


TEST(total_5,price1){
	Shop dd;
	EXPECT_EQ(10,dd.total_5(1,10));
	EXPECT_EQ(10,dd.total_5(2,5));
	EXPECT_EQ(10,dd.total_5(5,2));
	EXPECT_EQ(10,dd.total_5(10,1));
}
TEST(total_5,price_zero){
	Shop dd;
	EXPECT_EQ(0,dd.total_5(0,10));
	EXPECT_EQ(0,dd.total_5(10,0));
}
TEST(total_5,price_negative){
	Shop dd;
	EXPECT_EQ(-1,dd.total_5(-1,10));
	EXPECT_EQ(-1,dd.total_5(10,-1));
	EXPECT_EQ(-1,dd.total_5(-10,-1));
}

